<table>
  <tr>
    <td style="width: 600px;vertical-align: top;">
{%  if Others %}
  <h3>其他项目</h3>
  <p>要访问这些项目，请向项目管理者申请权限</p>
{% else %}
<span style="font-size: x-large;font-weight: bold;">选择一个项目</span>
  {% include "task/import_create_shared_doc.html" %}

{% if  CanCreate==True %}
  <button class="btn btn-success" onclick="CreateProject();">创建一个新的项目</button>
{% else %}
  <p style="margin-bottom: 0">若想创建新项目并上传图片，请联系网站管理员: </p><ul>{{ GetManagerList('Ecotaxa : Please provide me the Project creation rights')|safe }}</ul>
{% endif %}
{% endif %} {# If Others #}
</td>
  <td style="padding-left: 50px;vertical-align: top;">
  <div class="panel panel-default">
  <div class="panel-body">
    <form method="get">
      <table>
        <tr>
          <td>以标题来筛选:</td>
          <td><input type="text"  style="width: 100px;" name="filt_title" id="filt_title" value="{{ filt_title }}"></td>
          <td rowspan="2" style="vertical-align: top"><button type="submit" class="btn btn-primary btn-block"><span class="glyphicon glyphicon-search"></span> 搜索</button></td>
        </tr>
        <tr>
          <td style="padding-right: 10px;">去除子集 :</td>
          <td><input type="checkbox" value="Y" name="filt_subset"  {%  if filt_subset=='Y'  %}checked{%  endif  %}></td>
        </tr>
        <tr>
          <td>仪器 : </td>
          <td style="padding-right: 10px;"><input type="text" style="width: 100px;" name="filt_instrum" id="filt_instrum" value="{{ filt_instrum }}">
                <span class="glyphicon glyphicon-question-sign" onclick="DispInstrumList({{ g.Projid }});" style="cursor: pointer;"></span></td>
          <td  style="vertical-align: top"><a href="?filt_title=&filt_instrum=" class="btn btn-sm btn-default btn-block"><span class="glyphicon glyphicon-remove"></span> 清除</a></td>
        </tr>
      </table>
    </form>
  </div></div>
    </td>
  </tr>
</table>
<table class='table table-hover table-verycondensed projectsList'>
        <thead><tr>
                <th></th>
                <th>标题 [ID]</th>
                <th>状态</th>
                <th>对象的数量</th>
                <th>%&nbsp;已验证</th>
                <th>%&nbsp;已分类</th>
            </tr>
        </thead>
        <tbody>
{%   for r in PrjList %}
<tr><td>
{%  if Others %}
  <a class='btn btn-primary' href='mailto:{{r[6]}}?body={{ "Please provide me privileges to project : "+r[1]|urlencode }}&subject={{"Project access request"|urlencode }}'>请求访问</a>
  {% if r[8] ==True or isadmin  %}
    <a class='btn btn-primary' href='/prj/{{ r[0] }}'>浏览</a>
    {% endif %}
{% else %}
  <a class='btn btn-primary' href='/prj/{{r[0]}}'>选择</a>
{% endif %}

  </td>
  <td> {{ r[1] }} [{{ r[0] }}] {{ ("<a href='mailto:"+r[7]+"'>"+r[6]+"</a>") |safe if r[6] }}</td>
  <td>{{ r[2] }}</td>
  <td>{{ '{0:0.0f}'.format(r[3]) }}</td>
  <td>{{ '{0:0.2f}'.format(r[4]) }}</td>
  <td>{{ '{0:0.2f}'.format(r[5]) }}</td>
  </tr>
{%  endfor %}

</tbody></table>
<div class="col-sm-6 col-sm-offset-3">
{%  if Others %}
  <a href="/prj/" class="btn  btn-block btn-primary">返回到项目列表</a>
{% else %}
  <a href="/prjothers/" class="btn  btn-block btn-primary">显示未注册的项目 </a>
{% endif %}
</div>
<script>
  function DispInstrumList(projid){
  $("#PopupDetails .modal-content").html("Loading...");
  $('#PopupDetails .modal-lg').css('width',$(window).width()/2);
  $('#PopupDetails').modal({});
  var url="/search/instrumlist"
  if(typeof (projid)!="undefined")
    url+="?projid="+projid
  $("#PopupDetails .modal-content").load(url);
}
function CreateProject() {
  $('#PopupCreateProject').modal({});
}
function DoCreateProject() {
  $('#resultcreate').load('/prj/simplecreate/',{projtitle:$('#newprojecttitle').val()});

{#  alert("Not Yet implemted")#}
}
$('#filt_title').focus();

</script>
<div id="PopupDetails" class="modal " tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      ...
    </div>
  </div>
</div>

<div id="PopupCreateProject" class="modal " tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg">
    <div class="modal-content" style="width: 600px; padding: 20px;">
      <h3>创建一个新项目</h3>
      项目标题 : <input name="newprojecttitle" id="newprojecttitle" type="text" class="form-control" style="width: 400px;" autocomplete="off">
      <br><button class="btn btn-success" onclick="DoCreateProject();">创建这个项目</button>
      <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
      <div id="resultcreate" style="margin: 10px 0;"></div>

    <!-- <div id="ImportantNote" class="panel panel-danger" >
  <div class="panel-heading">
    <h3 class="panel-title">重要提示
    <button type="button" class="close" aria-label="Close" onclick="$('#ImportantNote').hide();"><span aria-hidden="true">&times;</span></button>
    </h3>
  </div>
  <div class="panel-body">
    EcoTaxa的维护和完善不是免费的。如果您能在下次拨款中拨出一些资金来支持它，我们将不胜感激。
    <br><a href="mailto:picheral@obs-vlfr.fr" title="Press CTRL to open it on another tab (usefull if you use GMail)">联系我们</a> ，评估什么数据是合理且有用的。
    </div></div> -->

    </div>
  </div>
</div>
